import request from './request';
import frontRequest from './frontRequest';
//首页推荐
export const reqRecommed=() => request.get('/xhr/index.json?__timestamp=1630131808529')

//分类
export const reqCateList = (categoryId) =>request.get('/item/cateList.json?__timestamp=1630131286110&categoryId='+categoryId)

//获取某个频道
export const reqList = (id)=>request.get('/item/list.json?__timestamp=1630136511866&categoryId='+id)

//商品列表数据
export const reqGoodsByCateIdAndSubId = (categoryId,subCategoryId)=>request.get(`/item/list.json?__timestamp=1630133942864&categoryType=0&subCategoryId=${subCategoryId}&categoryId=${categoryId}`)

//获取验证码
export const reqCode = (phone) => frontRequest.get(`/user/passport/sendCode/${phone}`)

//注册用户
export const reqRegister = (data) => frontRequest.post(`/user/passport/register`,data)

export const reqLogin = (data) => frontRequest.post(`/user/passport/login`,data)

//获取用户登录成功以后用户信息的接口
export const reqUserInfo = ()=>frontRequest({url:`/user/passport/auth/getUserInfo`,method:'get'});

//退出登录业务
export const reqUserLogout = ()=>frontRequest({url:`/user/passport/logout`,method:'get'});
export const reqCartList = ()=>frontRequest({url:`/cart/cartList`,method:'get'});
export const reqCartSwitchChecked = (skuId,isChecked)=>frontRequest({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'});
export const reqAddOrUpdateCart = (skuId,skuNum)=>frontRequest({url:`/cart/addToCart/${ skuId }/${ skuNum }`,method:'post'});
export const reqDeleteCart = (skuId)=>frontRequest({url:`/cart/deleteCart/${skuId}`,method:'delete'});

// http://43.138.25.182/api/user/passport/sendCode/18621848811
// http://127.0.0.1:9999/api/user/passport/sendCode/15687945621


// 值得买
export const reqBuying = () => request({method:'GET',url:'/topic/v1/know/navWap.json'})
export const reqShow = (page) => request({method:'GET',url:`/topic/v1/find/recAuto.json?page=${page}&size=2`})


// 商品详情
export const getDatailList =(id)=>frontRequest.get(`/item/${id}`)
//热门搜索
export const reqtHotList =()=>request.get(`/xhr/search/init.json`)
//实时搜索
export const reqtAutoList = (key) => request.post(`/xhr/search/searchAutoComplete.json?keywordPrefix=${key}`)
export const reqSearchList = (key) => request.get(`/xhr/search/search.json?__timestamp=1630133434953&needPopWindow=true&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=-1&floorPrice=-1&matchType=0&categoryId=0&descSorted=false&sortType=0&keyword=${key}`)
export const reqtradeList = () => frontRequest.get(`/order/auth/trade`)
export const reqAddressList = () => frontRequest.get(`/user/userAddress/auth/findUserAddressList`)
export const reqSubmitOrder = (tradeNo,data) => frontRequest.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,data)
export const reqOrderInfo = (orderId) => frontRequest.get(`/payment/weixin/createNative/${orderId}`)
export const reqPayStatus = (orderId) => frontRequest.get(`/payment/weixin/queryPayStatus/${orderId}`)

